Skip to content

replace incomplete compound types #3643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 8, 2019
Merged

Conversation

kroening
Copy link
Member

A key benefit will be that follow_tag will then be able to return the corresponding compound type.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are large changes without a commit message (plus the commit subjects don't parse for me), cpplint requests one assert to be replaced, and a rebase is required.

For the record: I am no longer going to review PRs containing commits without proper commit messages. Unfortunately GitHub does not support providing feedback on commit messages. The pull-request template contains a link to guidance on how to write commit messages. Should I receive a review request for a PR containing a commit violating commit-message guidance I'll reassign it to the author without comment. I am simply not willing to spend my time reverse engineering what a commit is about and why it is being proposed or why a change is the right thing to do.

@tautschnig tautschnig assigned kroening and unassigned tautschnig Dec 29, 2018
@kroening kroening force-pushed the incomplete_compound_types branch from 4087771 to ede4512 Compare December 30, 2018 09:45
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️
Passed Diffblue compatibility checks (cbmc commit: ede4512).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/95950633

@@ -418,13 +425,6 @@ void c_typecheck_baset::typecheck_redefinition_non_type(
PRECONDITION(old_symbol.type.id() != ID_symbol_type);
old_symbol.type=new_symbol.type;
}
else if((final_old.id()==ID_incomplete_c_enum ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we check the new is-incomplete flag here?

else
UNREACHABLE;
// mark as incomplete
compound_symbol.type.set(ID_incomplete, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provide a setter for this on struct_union_typet rather than directly twiddle IDs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

// "template_class_instance", to be elaborated later.
symbolt new_symbol;
new_symbol.name=identifier;
new_symbol.pretty_name=template_symbol.pretty_name;
new_symbol.location=template_symbol.location;
new_symbol.type=typet(ID_incomplete_struct);
new_symbol.type = typet(ID_struct);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use constructor? Or add a static struct_typet::make_incomplete_struct(const irep_idt &tag) or something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

new_type.set(ID_tag, new_symbol->base_name);
new_type.set(ID_incomplete, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use struct_union_typet interface?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@kroening kroening force-pushed the incomplete_compound_types branch from ede4512 to 0df2c36 Compare January 4, 2019 18:53
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️
Passed Diffblue compatibility checks (cbmc commit: 0df2c36).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96342190

Daniel Kroening added 2 commits January 8, 2019 11:44
…c_enum_type

1) The incomplete_struct type is replaced by the struct type with ID_incomplete set.

2) The incomplete_union type is replaced by the union type with ID_incomplete set.

3) The incomplete_c_enum type is replaced by the c_enum type with ID_incomplete set.

The question whether any of the compound types is incomplete is only
relevant to the front-ends; outside of the front-end, the existence of three
further types only adds unnecessary complexity.

This change further establishes the invariant that a struct_tag, union_tag,
c_enum_tag always points to a struct, union, c_enum type, respectively.
…compound type

A struct_tag, union_tag, c_enum_tag always points to a struct, union, c_enum
type, respectively.  This is now reflected in the return type of the method,
which implies that a number of explicit casts and checks can be removed.
@tautschnig tautschnig force-pushed the incomplete_compound_types branch from 0df2c36 to 4e031ff Compare January 8, 2019 11:45
Copy link
Collaborator

@tautschnig tautschnig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kroening Thank you very much for the elaborate commit messages, these are very helpful!

@tautschnig tautschnig mentioned this pull request Jan 8, 2019
4 tasks
@kroening kroening merged commit 5419894 into develop Jan 8, 2019
@kroening kroening deleted the incomplete_compound_types branch January 8, 2019 13:15
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️
Passed Diffblue compatibility checks (cbmc commit: 4e031ff).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/96604942

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants